import home from '@/pages/user-home.vue';
import {createRouter, createWebHashHistory, createWebHistory} from 'vue-router';
// 用户相关
import login from '~/pages/login.vue';
import register from '~/pages/register.vue';
import workorderList from '~/pages/workorder-list.vue';
import userWorkorderList from '~/pages/user-workorder-list.vue';
import workorderEvaluate from '~/pages/workorder-evaluate.vue';
import userHome from '~/pages/user-home.vue';
// 维修工相关
import repairmanHome from '~/pages/repairman-home.vue';
// 管理员相关
import adminHome from '~/pages/admin-home.vue';
import adminUserList from '~/pages/admin/user-list.vue';
import adminWorkorderList from '~/pages/admin/workorder-list.vue';
import adminDeviceList from '~/pages/admin/device-list.vue';

const routes = [
    {
        path: '/',
        name: 'home',
        component: home
    },
    {
        path: '/login',
        name: 'login',
        component: login
    },
    {
        path: '/register',
        name: 'register',
        component: register
    },
    {
        path: '/user-home',
        name: 'user-home',
        component: userHome
    },

    {   path: '/workorder-list',
        name: 'workorderList',
        component: workorderList},
    {   path: '/user-workorder-list',
        name: 'userWorkorderList',
        component: userWorkorderList    },
    {
        path: '/workorder-evaluate',
        name: 'workorderEvaluate',
        component: workorderEvaluate
    },
    {
        path: '/repairman-home',
        name: 'repairmanHome',
        component: repairmanHome
    },
    // 管理员相关路由
    {
        path: '/admin-home',
        name: 'adminHome',
        component: adminHome
    },
    {
        path: '/admin/user-list',
        name: 'adminUserList',
        component: adminUserList
    },
    {
        path: '/admin/workorder-list',
        name: 'adminWorkorderList',
        component: adminWorkorderList
    },
    {
        path: '/admin/device-list',
        name: 'adminDeviceList',
        component: adminDeviceList
    }
];

const router = createRouter({
    history: createWebHashHistory(),
    routes
});

export default router;
